package com.zatech.cgnci.project.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zatech.cgnci.project.dto.*;
import com.zatech.cgnci.project.entity.CgnciBusinessInsuranceDO;
import com.zatech.cgnci.project.vo.*;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 承保保单表 服务类
 * </p>
 *
 * @author Generator
 * @since 2024-12-20
 */
public interface CgnciBusinessInsuranceService extends IService<CgnciBusinessInsuranceDO> {

    List<CgnciBusinessInsurancePageVO> listBusinessInsurance(CgnciBusinessInsuranceQueryDTO queryDTO);

    IPage<CgnciBusinessInsurancePageVO> pageBusinessInsurance(CgnciBusinessInsuranceQueryDTO queryDTO);

    /**
     * @param insuranceId 业务id
     * @param type        1-保单 2-分入 3-分出 4-理赔
     * @return
     */
    CgnciBusinessInsuranceMainVO detail(Long insuranceId, String type);

    /**
     * @param updateDTO
     * @param type      1-保单 2-分入 3-分出
     * @return
     */
    CgnciBusinessInsuranceDO saveOrUpdateBusinessInsurance(CgnciBusinessInsuranceSaveOrUpdateDTO updateDTO, String type);

    void submit(FlowTaskSubmitDTO flowTaskDTO);

    void approve(FlowTaskApprovalDTO flowTaskDTO);

    void back(FlowTaskBackDTO flowTaskDTO);

    void signOut(Long insuranceId);

    List<ApprovalRecordVO> log(Long insuranceId);

    /**
     * 通过保单号查询保单相关信息
     *
     * @param policyNo
     * @return
     */
    CgnciBusinessInsuranceMainVO getPolicyInfo(String policyNo);

    /**
     * 根据保单号查询分入分出信息
     *
     * @param policyNo
     * @return
     */
    CgnciBusinessInsuranceClaimVO getInsuranceClaim(String policyNo, String caseNo);

    CgnciBusinessInsuranceDO nextProjectCreate(CgnciBusinessInsuranceNextCreateDTO addCreateDTO);

    CgnciBusinessInsuranceDO nextInsuranceCreate(CgnciBusinessInsuranceNextCreateDTO addCreateDTO);

    CgnciBusinessInsuranceDO nextDivideInCreate(CgnciBusinessDivideInNextCreateDTO addCreateDTO);

    /**
     * 获取净自留份额
     * @param lfDivideOutVO
     * @param directInsuranceVO
     * @return
     */
    BigDecimal getRetentionAmount(CgnciReinsuranceInfoVO lfDivideOutVO, CgnciDirectInsuranceVO directInsuranceVO);
}
